package com.sheledon.flyCat.core.resolver;

import com.sheledon.flyCat.annotation.springmvc.PathVariable;
import com.sheledon.flyCat.common.pojo.MethodDetail;
import com.sheledon.flyCat.common.utils.ObjectUtils;
import com.sheledon.flyCat.common.utils.ReflectionUtils;
import com.sheledon.flyCat.core.factory.RequestRouteMapper;

import java.beans.PropertyEditor;
import java.beans.PropertyEditorManager;
import java.lang.reflect.Parameter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * @author sheledon
 */
public class PathVariableParameterResovler implements ParameterResolver{
    @Override
    public Object resolve(MethodDetail methodDetail, Parameter parameter) {
        PathVariable annotation = parameter.getAnnotation(PathVariable.class);
        String name = annotation.value();
        String value = methodDetail.getUrlParamsMap().get(name);
        return ObjectUtils.convert(parameter.getType(),value);
    }
}
